package main

import (
	"fmt"

	"goframex/handle"
	"goframex/middleware"

	"github.com/gogf/gf/v2"
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
)

func main() {
	fmt.Println("Hello GF:", gf.VERSION)
	s := g.Server()
	group := s.Group("/")

	initRouter(group)

	s.SetOpenApiPath("/api.json")
	s.SetSwaggerPath("/swagger")
	s.SetAddr("0.0.0.0")
	s.SetPort(8080)
	//s.SetTLSConfig(tlsx.TlsCfg())
	s.Run()
}

func initRouter(group *ghttp.RouterGroup) {
	group.Middleware(middleware.Middleware, middleware.ErrorHandler)
	handle.Req{}.InitRouter(group)
	handle.Resp{}.InitRouter(group)
	handle.BindFunc{}.InitRouter(group)
}
